#include <bits/stdc++.h>
#define int long long 
using namespace std;

const int maxn = 1e5 + 5;

int n, m;
vector<int> ad[maxn];
int cnt[maxn];
struct P{
	int idx;
	int num;
}ps[maxn];

bool cmp(P p1, P p2){
	if (p1.num > p2.num) {
		return true;
	} else if (p1.num == p2.num) {
		return p1.idx < p2.idx;
	}
	return false;
}

void dfs(int u, int p){
	for (int to: ad[u]) {
		if (to==p) {
			continue;
		}
		dfs(to, u);
		cnt[u] += cnt[to];
	}
}

void solve(){
	cin >>n>>m;
	for (int i=1;i<n;i++) {
		int a ,b;
		cin >> a>>b;
		ad[a].push_back(b);
		ad[b].push_back(a);
	}
	
	for (int i=1;i<=n;i++) {
		cnt[i] = 1;
	}
	
	dfs(1, 0);
	
	
	for (int i=1;i<=n;i++) {
		ps[i].idx = i;
		ps[i].num = cnt[i];
	}
	
	sort(ps+1, ps+1+n, cmp);
	
	
	for (int i=1;i<=n;i++) {
		if (ps[i].idx==m) {
			cout << i << '\n';
			return;
		}
//		cout << i << ": " << ps[i].num << '\n';
	}
	
}

signed main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	solve();
	return 0;
}
